package com.fh.module_main.ui.fragment

import com.alibaba.android.arouter.facade.annotation.Route
import com.fh.lib_base.base.BaseFragment
import com.fh.lib_base.config.AppConstants
import com.fh.module_main.R
import com.fh.module_main.databinding.MainFragmentMainBinding
import com.fh.module_main.viewmodel.MainFragmentViewModel
import com.gyf.immersionbar.ImmersionBar
import com.fh.module_main.BR
import com.fh.module_main.ext.init
import com.fh.module_main.ext.initMain
import com.fh.module_main.ext.interceptLongClick

@Route(path = AppConstants.Router.Main.MAIN_FRAGMENT)
class MainFragment: BaseFragment<MainFragmentMainBinding, MainFragmentViewModel>() {

    override fun initVariableId(): Int {
        return BR.viewModel
    }
    override fun initContentView(): Int {
        return R.layout.main_fragment_main
    }
    override fun onSupportVisible() {
        ImmersionBar.with(this).statusBarDarkFont(false).init()
    }

    override fun initData() {
        //初始化viewpager2
        binding.mainViewpager.initMain(this)
//        //初始化 bottomBar
        binding.mainBottom.init{
            when (it) {
                R.id.menu_search -> binding.mainViewpager.setCurrentItem(0, false)
                R.id.menu_myhotel -> binding.mainViewpager.setCurrentItem(1, false)
                R.id.menu_mine -> binding.mainViewpager.setCurrentItem(2, false)
            }
        }
        binding.mainBottom.interceptLongClick(R.id.menu_search,R.id.menu_myhotel,R.id.menu_mine)
    }

    override fun initViewObservable() {

    }
    override fun useBaseLayout(): Boolean {
        return false
    }
}